# $Id: PKGBUILD 87334 2013-03-29 22:55:30Z arodseth $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Sebastien Binet <binet@cern.ch>

pkgname=waf
pkgver=1.7.10
pkgrel=1
pkgdesc='General-purpose build system modelled after Scons'
url='http://code.google.com/p/waf/'
arch=('any')
license=('BSD')
depends=('python')
provides=('python-waf')
source=("http://$pkgname.googlecode.com/files/$pkgname-$pkgver.tar.bz2")
sha256sums=('2610240d789b6103e7cbad4187e49a1c557f12b13707dcf3056c9875a4627614')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  ./waf-light configure --prefix=/usr
  ./waf-light --make-waf

  msg2 'Extracting license...'
  head -n 30 waf | tail -n 25 > LICENSE

  sed -i '0,/env python/s//python3/' waf
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  ./waf-light install -f --destdir="$pkgdir" \
    --tools='compat,compat15,ocaml,go,cython,scala,erlang,cuda,gcj,boost,pep8'

  install -Dm755 waf "$pkgdir/usr/bin/waf"
  # Force the generation of .waf.admin files
  cd demos/c
  "$pkgdir/usr/bin/waf" configure build >& /dev/null
  cd ../..

  msg2 'Setting permissions...'
  chmod -R 0644 "$pkgdir"/usr/bin/.waf*/waflib/Tools/*
  chown -R root:root "$pkgdir"/usr/*

  msg2 'Packaging license...'
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et:
